<!DOCTYPE html>
<html lang="en">
<head>

    <style></style>
    <title>proba</title>
    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script>$(document).ready(function() {                           // When the HTML DOM is ready loading, then execute the following function...
    $('#somebutton').click(function() {                  // Locate HTML DOM element with ID "somebutton" and assign the following function to its "click" event...
    $.get('table', function(responseJson) {    // Execute Ajax GET request on URL of "someservlet" and execute the following function with Ajax response JSON...
    var $table = $('<table>').appendTo($('#somediv')); // Create HTML <ul> element and append it to HTML DOM element with ID "somediv".
    $.each(responseJson, function(index, mood) {// Iterate over the JSON array.
    $('<tr>').appendTo($table)                     // Create HTML <tr> element, set its text content with currently iterated item and append it to the <ul>.
                    .append($('<td>').text(mood.moodId))        // Create HTML <td> element, set its text content with id of currently iterated product and append it to the <tr>.
                    .append($('<td>').text(mood.userId))      // Create HTML <td> element, set its text content with name of currently iterated product and append it to the <tr>.
                    .append($('<td>').text(mood.time));
        });
        });
        });
        });
    </script>
</head>
<body>
<button id="somebutton">press here</button>
<div id="somediv"></div>
</body>
</html>
